<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>就业工作考核数据分析系统</title>
    <link rel="shortcut icon" th:href="@{/images/favicon.ico}" type="image/x-icon}" />
    <link rel="stylesheet" type="text/css" th:href="@{/font-awesome-4.7.0/css/font-awesome.min.css}">
    <link rel="stylesheet" th:href="@{/css/bootstrap.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/dist/css/txt.wav.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/css/index.css}" />
    <link rel="stylesheet" type="text/css" th:href="@{/css/result.css}">
    <style>
        @keyframes daoru
        {
            from {transform:scale(0.5)}
            to {transform:scale(1)}
        }
    </style>
</head>
<body>
<header>
    <h1>
        <!--<img th:src="@{/images/top1.png}"/>-->
        <span class="txtwav bounce">就业工作考核数据分析系统</span>
    </h1>
    <ul class="rt_nav">
        <li>
            <a th:href="@{/toindex}" target="_blank" class="website_icon">
                <i class="fa fa-fire"></i>
                <span>站点首页</span>
            </a>
        </li>
        <li>
            <a th:href="@{/out}" class="quit_icon">
                <i class="fa fa-send"></i>
                <span>安全退出</span>
            </a>
        </li>
    </ul>
</header>
<aside class="aside_nav">
    <ul>
        <div class="closeche">
            <i class="fa fa-caret-right"></i>
        </div>
        <li>
            <a th:href="@{/toindex}">欢迎登录</a>
        </li>
        <li  class="active">
            <a th:href="@{/sq/search}">生源质量指数</a>
            <i class="fa fa-angle-double-right"></i>
        </li>
        <li>
            <a th:href="@{/ts/search}">师资结构指数</a>
        </li>
        <li>
            <a th:href="@{/em/search}">就业状态指数</a>
        </li>
        <li>
            <a th:href="@{/employmentRate/findAll}">就业率指数</a>
        </li>
        <li  style="white-space : nowrap;">
            <a th:href="@{/es/search}">用人单位满意度指数</a>
        </li>
        <li>
            <a th:href="@{/employmentPractice/findAll}">就业创业实践指数</a>
        </li>
        <li>
            <a th:href="@{/year/to}">年份管理</a>
        </li>
        <li>
            <a th:href="@{/college/to}">学院管理</a>
        </li>
    </ul>
</aside>
<section class="wrap " th:if="${mark == 1}">
    <div class="tables">
        <section>
            <h1 class="top-title">生 源 质 量 指 数</h1>
        </section>
        <section>
            <select class="selects" id="select" th:if="${query.getYear()!=null}">
                <option th:value="${query.getYear()}" hidden disabled selected th:text="${query.getYear()}"></option>
                <option value="">请选择年份</option>
                <option class="selects" th:each="year1:${allYear}" th:value="${year1.getYearName()}" th:text="${year1.getYearName()}"></option>
            </select>
            <select class="selects" id="select" th:if="${query.getYear()==null}">
                <option value="" selected>请选择年份</option>
                <option class="selects" th:each="year1:${allYear}" th:value="${year1.getYearName()}" th:text="${year1.getYearName()}"></option>
            </select>
            <input type="button" id="import" value="导入" class="result" />
            <input type="file" style="display: none" id="importfile" enctype="multipart/form-data">
            <a id="link" href="#" style="text-decoration:none;">
                <input type="button" id="export" value="导出" class="result" />
            </a>
            <script>
                window.onload=function () {
                    // 拿到所有操作的年份// 用于导出
                    var select='';
                    $('#select').change(function () {
                        select = $("#select option:selected").val();
                        var Url = "/sq/export?year=";
                        Url = Url+select;
                        if(select == ''){
                            Url='#';
                        }
                        $("#link").attr('href',Url);
                    });
                    $("#export").click(function () {
                        if( $('#link').attr('href') == '#' ){
                            alert("请选择年份！")
                        }
                    });
                    // 导入
                    $('#import').click(function () {
                        if(select == ''){
                            alert('请选择年份!')
                        }else {
                            $('#importfile').click();
                        }
                    });
                    $('#importfile').change(function () {
                        $('#window-black').css('display','block');
                        var file =document.getElementById('importfile').files[0];
                        var formData = new FormData();
                        formData.append('year',select);
                        formData.append('file',document.getElementById('importfile').files[0]);
                        console.log(file);
                        $.ajax({
                            type: "post",
                            url: "/sq/import",
                            processData:false,
                            data:formData,
                            contentType:false,
                            mimeType:"multipart/form-data",
                            dataType: "json",
                            success: function (data) {
                                $('#window-Tips').text(data.msg);
                                setTimeout(function () {
                                    $('#window-black').css('display','none');
                                },1000);
                                window.location.href='/sq/search';
                            }
                        })
                    });
                    $('#delete').click(function () {
                        if(select == ''){
                            alert('请选择年份!')
                        }else{
                            $('#window-black').css('display','block');
                            $('#window-Tips').text('删除中，请稍后');
                            $.ajax({
                                type: "get",
                                url: "/sq/delete",
                                data: {
                                    'year': select
                                },
                                dataType: "json",
                                success: function (data) {
                                    $('#window-Tips').text(data.msg);
                                    setTimeout(function () {
                                        $('#window-black').css('display','none');
                                    },1000);
                                    window.location.href='/sq/search';
                                }
                            })
                        }
                    })
                    $('.reinport').click(function () {
                        $('#Correspondingfile').click();
                    });
                    $('#Correspondingfile').change(function () {
                        $('#window-black').css('display','block');
                        var formData = new FormData();
                        formData.append('file',document.getElementById('Correspondingfile').files[0]);
                        $.ajax({
                            type: "post",
                            url: "/major/import",
                            processData:false,
                            data:formData,
                            contentType:false,
                            mimeType:"multipart/form-data",
                            dataType: "json",
                            success: function (data) {
                                $('#window-Tips').text(data.msg);
                                setTimeout(function () {
                                    $('#window-black').css('display','none');
                                },1000);
                                window.location.href='/sq/search';
                            }
                        })
                    })
                }
            </script>
            <input type="button" id="delete" value="删除" class="result" />
            <input type="hidden" class="reinport result" value="重新导入学院专业对应表">
            <input type="file" style="display: none" id="Correspondingfile">
            <div class="searrch">
                <form th:action="@{/sq/search}" th:method="get">
                    <input id="college" placeholder="请输入学院或专业" type="text" class="ipt" name="majorName">
                    <input type="text" style="display: none" id="searchyear" name="year">
                    <input type="submit" id="search" class="submit" value="搜索">
                </form>
            </div>
        </section>
        <div class="resultform">
            <table class="table table-bordered table-hover">
                <thead>
                <tr>
                    <th>学院</th>
                    <th>专业</th>
                    <th>专业认可度原始</th>
                    <th>高考成绩与最高值比</th>
                    <th>专业优势54.5</th>
                    <th>分学院优势</th>
                    <th>报到率45.5</th>
                    <th>年份</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="employ: ${employerSatisfactions}">
                    <td th:text="${employ.colleageName}"></td>
                    <td th:text="${employ.majorName}"></td>
                    <td th:text="${employ.majorRecognition}"></td>
                    <td th:text="${employ.collegeEntrance}"></td>
                    <td th:text="${employ.majorAdvantage}"></td>
                    <td th:text="${employ.colleageAdvantage}"></td>
                    <td th:text="${employ.yieldRate}"></td>
                    <td th:text="${employ.year}"></td>
                </tr>
            </table>
        </div>
    </div>
    <!-- 分页 -->
    <div class="fenye" style="text-align:center" th:if="${pages > 0}">
        <ul class="pagination" th:if="${pages > 1}">
            <li th:if="${current == 1}"><a class="noclick" href="javascript:;">首页</a></li>
            <li><a th:if="${current > 1}" th:href="@{/sq/search(pageNum=1,year=${query.getYear()},college=${query.getCollege()})}">首页</a></li><!--//跳转至第一页-->
            <li><a th:if="${current > 1}" th:href="@{/sq/search(pageNum=${current-1},year=${query.getYear()},college=${query.getCollege()})}">上一页</a></li>
            <!--//请求页数-1-->
            <li class="active" th:each="i:${#numbers.sequence(1,pages)}">
                <!--//从1到总页数遍历，并赋值给i    TotalPages&ndash;&gt;总页数-->
                <a th:if="${i > current-5} and ${i < current+5} and ${i == current}" class="pageOne"
                   style="background-color: #18b985;border: 1px solid #ddd;" href="javascript:void(0);"
                   th:text="${i}">#</a>
                <!--//限制显示页数的条数  4到6个页数   而且等于当前页，不能点击-->
                <a th:if="${i > current-5} and ${i < current+5} and ${i != current}"
                   th:href="@{/sq/search(pageNum=${i},year=${query.getYear()},college=${query.getCollege()})}" th:text="${i}"
                   style="color: #000000;background-color: #fff;border: 1px solid #ddd;cursor: pointer;"
                   class="hoveras">#</a><!--//限制显示页数的条数  4到6个页数-->
            </li>
            <li th:if="${current != pages}"><a
                    th:href="@{/sq/search(pageNum=${current+1},year=${query.getYear()},college=${query.getCollege()})}">下一页</a></li><!--//请求页数+1-->
            <li th:if="${current == pages}"><a
                    class="noclick" href="javascript:;">尾页</a></li>
            <li th:if="${current != pages}"><a
                    th:href="@{/sq/search(pageNum=${pages},year=${query.getYear()},college=${query.getCollege()})}">尾页</a></li><!--//跳转至第Number页-->
        </ul>
    </div>
</section>
<section class="wrap " th:if="${mark == -1}">
    <input type="button" class="result Corresponding" value="导入学院专业对应表">
    <input type="file" style="display: none" id="Correspondingfile">
</section>
<div id="window-black" style="display: none;width: 100%;height: 100%;background:rgba(0,0,0,0.5);position: fixed;z-index: 9;top: 0;left: 0;">
    <div style="width: 240px;height: 30px;position: absolute;top: 50%;left: 50%;margin-top: -15px;margin-left: -120px;">
        <div style="width: 25px;height: 25px;background-color: white;border-radius: 100%;margin: 0 15px;float: left;animation: daoru 1s 0s infinite;"></div>
        <div style="width: 25px;height: 25px;background-color: white;border-radius: 100%;margin: 0 15px;float: left;animation: daoru 1s 0.1s infinite;"></div>
        <div style="width: 25px;height: 25px;background-color: white;border-radius: 100%;margin: 0 15px;float: left;animation: daoru 1s 0.2s infinite;"></div>
        <div style="width: 25px;height: 25px;background-color: white;border-radius: 100%;margin: 0 15px;float: left;animation: daoru 1s 0.3s infinite;"></div>
    </div>
    <div id="window-Tips" style="color: white;font-size: 30px;width: 300px;height: 40px;position: absolute;top: 50%;left: 50%;text-align: center;margin-left: -150px;margin-top: 50px;">导入中，请稍后</div>
</div>
</body>
<script th:src="@{/js/jquery-2.1.0.js}"></script>
<script th:src="@{/dist/js/txt.wav.min.js}"></script>
<script th:src="@{/js/result.js}"></script>
<script type="text/javascript">
    $(function() {
        //确定文档高度
        var winheight = $(window).height();
        winheight -= 70;
        $('.wrap').css('height', winheight);
        //点击缩回
        $('.closeche').on('click', function() {
            if($('.aside_nav').css('left') == '0px') {
                $('.aside_nav').css('left', '-210px');
                $('.wrap').css({
                    'width': '95%',
                    'margin-left': '40px'
                });
            } else {
                $('.aside_nav').css('left', '0px');
                $('.wrap').css({
                    'width': '',
                    'margin-left': '258px'
                })
            }
        })
    });
</script>
</html>